#include <ros/ros.h>
#include <std_msgs/Bool.h>
#include <iostream>


using namespace std;


void run(const std_msgs::BoolConstPtr& msg)
{

    if(msg)
    {
        sleep(5);
        system("rosrun map_server map_server map.yaml");
    }

  
}

int main(int argc,char **argv)
{
  ros::init(argc,argv,"map_launcher");
  ros::NodeHandle n;
  
  ros::Subscriber sub = n.subscribe("/run_map",1,run);
  
  
  ros::Rate loop_rate(10);
  
  while(ros::ok())
  {
  
    ros::spinOnce();
    loop_rate.sleep();
  }
  
  return 0;
}
